<!--
 * @Descripttion: 
 * @Author: cbing
 * @Date: 2019-09-15 16:11:04
 * @LastEditors: cbing
 * @LastEditTime: 2019-09-15 16:12:15
 -->
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title></title>
    <meta name="keywords" content="">
    <meta name="description" content="">
    <link rel="shortcut icon" href="favicon.ico"> 
	<link href="__PUBLIC__/admin/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="__PUBLIC__/admin/css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <link href="__PUBLIC__/admin/css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="__PUBLIC__/admin/css/animate.css" rel="stylesheet">
    <link href="__PUBLIC__/admin/css/style.css?v=4.1.0" rel="stylesheet">
</head>
<script>
var url = "{:url('Im/serviceMember')}";
var updateUrl = "{:url('Im/serviceMember')}";
var gurl = "/{$Request.module}";
</script>

<body class="gray-bg">
<style>
input.error{
	border:1px solid red;
}
span.error{
	padding-top:10px;
	color: #f00;
	font-size:12px;
}
</style>
    <div class="wrapper wrapper-content">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>绑定平台客服</h5>
                    </div>
                    <div class="ibox-content">
                    <form method="post" class="form-horizontal" id="form">
                        <div class="form-group">
                            <label class="col-sm-2 control-label">选择会员：</label>
                            <div class="col-sm-6">
                                <button type="button" class="btn btn-success" onclick="selectMember();">选择会员信息</button>
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">已选择的会员信息：</label>
                            <div class="col-sm-8">
                                <table class="table table-hover table-bordered" style="width: 73%;">
                                    <thead class="biaoge">
                                    <tr><th style="width:30%">会员名称</th><th style="width:20%">头像</th><th style="width:15%">电话</th><th style="width:15%">操作</th></tr>
                                    </thead>
                                    <tbody id="member_list">
                                    <tr>
                                        <input type="hidden" name="user_id" value="{$member.id}">
                                        <td>{$member.user_name}</td>
                                        <td><img src="{$member.headimgurl}" width="100px" height="100px" onerror="this.src='__PUBLIC__/admin/img/nopic.jpg'" /></td>
                                        <td>{$member.phone}</td>
                                        <td><button type="button" class="btn btn-danger btn-xs" onclick="$(this).parent().parent().remove();"><i class="fa fa-close"></i>&nbsp;移除</button></td>
                                    </tr>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>

                        <input type="hidden" name="id" value="{$member.id}" />

                            <div class="form-group">
                                <div class="col-sm-4 col-sm-offset-2">
                                    <button class="btn btn-primary" type="submit" id="doSubmit" style="margin-right:20px;">保存</button>
                                    <button type="reset" class="btn btn-default">重置</button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!-- 全局js -->
    <script src="__PUBLIC__/admin/js/jquery.min.js?v=2.1.4"></script>
    <script src="__PUBLIC__/admin/js/bootstrap.min.js?v=3.3.6"></script>
    <!-- 自定义js -->
    <script src="__PUBLIC__/admin/js/plugins/layer/layer.min.js"></script>
    <script src="__PUBLIC__/admin/js/plugins/validate/jquery.validate.min.js"></script>	
    <script src="__PUBLIC__/admin/js/content.js?v=1.0.0"></script>
    <!-- iCheck -->
    <script src="__PUBLIC__/admin/js/plugins/iCheck/icheck.min.js"></script>
    <script src="__PUBLIC__/admin/js/common/ajax.js"></script>

	 <script>	
    	$(function(){    		
            $('.i-checks').iCheck({
                checkboxClass: 'icheckbox_square-green',
                radioClass: 'iradio_square-green',
            });

    	    var icon = "<i class='fa fa-times-circle'></i>&nbsp;&nbsp;";
        	$('#form').validate({
	            errorElement : 'span',
	        	debug: true,//只验证不提交表单
	            //layer ajax提交表单
	            submitHandler:function(){
	               // 序列化 表单数据 后提交 ，太简洁了
	            	post(updateUrl,'POST',$('#form').serialize(),1);
	                return false;
	            },//这是关键的语句，配置这个参数后表单不会自动提交，验证通过之后会去调用的方法

                rules:{
                    user_name:{
                        required:true,
                    },
                    phone:{
                        required:true,
                    },

                },

                messages:{
                    user_name:{
                        required:icon+'必填',
                        remote:icon+'已存在'
                    },
                    phone:{
                        required:icon+'必填',
                        remote:icon+'已存在'
                    },
                }
            });
      });
        function selectMember(){
            var type = 1;
            var memberurl = gurl+"/get_member/lst?type="+type;
            layer.open({
                type: 2,
                title: '选择会员信息',
                shadeClose: true,
                shade: 0.3,
                area: ['70%', '80%'],
                content: memberurl,
            });
        }

        function call_backmember(table_html){
            layer.closeAll('iframe');
            $('#member_list').empty();;
            $('#member_list').append(table_html);
        }
        function yichu(obj){
            $(obj).parent().parent().remove();
        }
      function cl(){
    	  location.href = url;
      }
    </script>

</body>
</html>